package greedy;

public class Solution55 {
    public  boolean canJump(int[] nums) {
        //记录我能到达的最远长度
        int farthest = 0;

        for (int i = 0; i <= farthest; i++) {

            int newFarthest = i + nums[i];

            if (newFarthest >= nums.length-1){
                return true;
            }

            if (newFarthest > farthest){
                farthest = newFarthest;
            }

        }

        return false;
    }


}
